<?php

include(dirname(__FILE__) . '/../bootstrap/unit.php');
require_once sfConfig::get('sf_symfony_lib_dir') . '/util/sfToolkit.class.php';
require_once sfConfig::get('sf_symfony_lib_dir') . '/yaml/sfYaml.php';

$testCases = sfYaml::load(dirname(__FILE__) . '/fixtures.yml');
$t = new lime_test(count($testCases));
$t->diag('MapAdmin::slugify()');
foreach ($testCases as $case) {
    $t->is(VirtualStore::slugify($case['input']),
            $case['output'], $case['comment']);
}

$testCases = sfYaml::load(dirname(__FILE__) . '/fixtures_getagefrom.yml');
$tst = new lime_test(count($testCases));
$tst->diag('MapAdmin::ageFrom()');
$today_date = date("Y-m-d", mktime(0, 0, 0, 6, 9, 2010));
foreach ($testCases as $case) {
    
    $dob = date("Y-m-d", mktime(0, 0, 0, $case['dob']['day'], $case['dob']['month'], $case['dob']['year']));
    $tst->is(VirtualStore::ageFrom($today_date, $dob),
            $case['age'],
            sprintf('Age for date %s on a today %s is %s', $dob, $today_date, $case['age']));
}
?>
